<!DOCTYPE html>
<!-- Copyright (C) 2020  Matthew "strager" Glazar -->
<!-- See end of file for extended copyright information. -->
<html lang="en">
  <head>
    <%- await include("../common-head.ejs.html") %>
    <script>
      //<%
      let url = await import("url");
      let moduleCacheBust = "#" + Date.now();

      let {
        ProblemsError,
        documentationDirectoryPath,
        loadErrorDocumentationFilesAsync,
        reportProblemsInDocumentsAsync,
      } = await import(
        url.pathToFileURL("../../src/error-documentation.mjs") + moduleCacheBust
      );

      let documents = await loadErrorDocumentationFilesAsync(
        documentationDirectoryPath
      );
      //%>
    </script>
    <title>quick-lint-js: errors and warnings</title>
    <meta
      name="description"
      content="quick-lint-js provides helpful error messages."
    />
    <link href="../main.css" rel="stylesheet" />
    <style>
      figure {
        margin-left: 2em;
        margin-right: 2em;
      }

      .table-of-contents a:link:not(:hover, :focus) {
        text-decoration: none;
      }

      a.self-reference:link,
      a.self-reference:visited {
        color: unset;
      }
      a.self-reference:link:not(:hover, :focus) {
        text-decoration: none;
      }

      .unicode-bom:before {
        content: "BOM";
        background-color: #edbf66;
        border: 1px solid red;
        border-radius: 5px;
        padding: 1px 3px;
      }

      @media (prefers-color-scheme: dark) {
        .unicode-bom:before {
          background-color: #884444;
        }
      }
    </style>
  </head>

  <body class="side-bar-nav">
    <header>
      <h1><a href="../">quick-lint-js</a></h1>
      <p class="tag-line">quick-lint-js finds bugs in JavaScript programs.</p>
      <%- await include("../common-nav.ejs.html") %>
    </header>

    <main>
      <p>
        quick-lint-js can find the following warnings and errors in your code:
      </p>

      <% try { await reportProblemsInDocumentsAsync(documents); } catch (e) { if
      (e instanceof ProblemsError) { %>
      <div
        style="background-color: #fdd; border: 1px solid #f00; padding: 0.5em"
      >
        <p>
          quick-lint-js found inconsistencies in the error documentation. If
          you're hacking on the website, rebuild quick-lint-js for the website
          by following <code>wasm/README.md</code> and
          <code>website/README.md</code>.
        </p>
        <p style="white-space: pre-line"><%= e %></p>
      </div>
      <% } else { throw e; } } %>

      <ul class="table-of-contents">
        <% for (let doc of documents) { %>
        <li>
          <a href="#<%= doc.titleErrorCode %>"
            ><%= doc.titleErrorCode %>: <%= doc.titleErrorDescription %></a
          >
        </li>
        <% } %>
      </ul>

      <% for (let doc of documents) { %> <%- doc.toHTML() %> <% } %>
    </main>

    <footer><%- await include("../common-footer-nav.ejs.html") %></footer>
  </body>
</html>

<!--
quick-lint-js finds bugs in JavaScript programs.
Copyright (C) 2020  Matthew "strager" Glazar

This file is part of quick-lint-js.

quick-lint-js is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

quick-lint-js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with quick-lint-js.  If not, see <https://www.gnu.org/licenses/>.
-->
